const Router = require("koa-router")
const Check = require('./check')

/**
 * 路由对象
 * @type {Router}
 */
const router = new Router({
	prefix: '/pdf'
})

/**
 * 自定义PDF组件显示
 */
router.get('/pdfvue', async function (ctx, next) {
  Check.pdfvue(ctx)
  ctx.redirect(`https://cdn.wangyabin.top/YBWeb/view/web/pdf.html?file=${ctx.vals.file}`);
})

/**
 * PDF.JS显示
 */
router.get('/pdfjs', async function (ctx, next) {
  Check.pdfjs(ctx)
  ctx.redirect(`https://cdn.wangyabin.top/Extension/pdf/web/index.html?file=${ctx.vals.file}`);
})

module.exports = router
